<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学习轨迹</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.0/css/all.min.css">
    <link rel="stylesheet" href="css/learn-track.css">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#165DFF',
                        secondary: '#0CB07B',
                        neutral: '#F5F7FA',
                        dark: '#1D2129',
                        light: '#FFFFFF'
                    },
                    fontFamily: {
                        inter: ['Inter', 'system-ui', 'sans-serif'],
                    },
                }
            }
        }
    </script>
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .card-shadow {
                box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            }
            .btn-hover {
                transition: all 0.3s ease;
            }
            .btn-hover:hover {
                transform: translateY(-2px);
                box-shadow: 0 4px 12px rgba(22, 93, 255, 0.2);
            }
        }
        body {
            background-image: url('/images/background.jpg'); /* 假设图片放在public/images目录下 */
            background-size: cover;
            background-position: center;
            background-attachment: fixed;
            background-repeat: no-repeat;
            z-index: -1;  /* 确保低于内容层级 */
        }

            body::before {
                display:none;
            }
    /* 模态框基础样式 */
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    .modal.active {
        opacity: 1;
        visibility: visible;
        display: flex;
    }
    
    .modal-content {
        background: white;
        border-radius: 12px;
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
        width: 90%;
        max-width: 600px;
        max-height: 90vh;
        overflow-y: auto;
        transform: translateY(20px);
        transition: all 0.3s ease;
        background: linear-gradient(135deg, rgba(219, 234, 254, 0.95), rgba(224, 231, 255, 0.95));
    border: 1px solid rgba(99, 102, 241, 0.2);
    }
    
    .modal.active .modal-content {
        transform: translateY(0);
    }
    
    .modal-header {
        padding: 20px;
        border-bottom: 1px solid #eee;
        position: relative;
    }
    
    .modal-title {
        font-size: 1.25rem;
        font-weight: 600;
        color: #2c3e50;
        margin: 0;
    }
    
    .close {
        position: absolute;
        top: 20px;
        right: 20px;
        font-size: 1.5rem;
        color: #7f8c8d;
        cursor: pointer;
        background: none;
        border: none;
    }
    
    .close:hover {
        color: #2c3e50;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 20px;
        border-top: 1px solid #eee;
        display: flex;
        justify-content: flex-end;
        gap: 10px;
    }
    
    /* 响应式调整 */
    @media (max-width: 640px) {
        .modal-content {
            width: 95%;
        }
    }
    /* 添加到learn-track.html的<style>部分 */
        #chapterList {
    padding: 0;
    margin: 0;
}

#chapterList .chapter-container {
    margin-bottom: 20px;
}

.course-box {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 20px;
    transition: all 0.3s ease;
}

.course-box:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* 添加下拉菜单样式 */
#user-dropdown{
        border: 1px solid #e5e7eb;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    #user-dropdown a:hover{
        background-color: #f9fafb;
    }
    </style>
</head>

<body class="bg-neutral font-inter text-dark">
    <header class="bg-primary text-white shadow-sm sticky top-0 z-50">
        <div class="container mx-auto px-4 py-3 flex justify-between items-center">
            <div class="flex items-center space-x-2">
                <i class="fa-solid fa-book-open text-white text-2xl"></i>
                <h1 class="text-xl font-bold text-white">学习轨迹</h1>
            </div>
            <nav>
                <ul class="flex space-x-6 items-center">
                    <li><a href="#" class="text-white hover:text-neutral-200 transition-colors duration-300">返回</a></li>
                </ul>
            </nav>
            <div class="flex items-center space-x-3">
                <!-- 修改开始：添加用户信息容器 -->
                <div id="user-info-container" class="hidden text-right mr-2">
                    <div id="user-name" class="font-medium text-white"></div>
                    <div id="student-id" class="text-xs text-white/80"></div>
                </div>
                <!-- 头像区域（添加下拉菜单） -->
                <div class="relative">
                    <a href="#" id="user-avatar" class="text-white hover:text-neutral-200 transition-colors duration-300">
                        <i class="fa-solid fa-user-circle text-xl"></i>
                    </a>
                    <!-- 下拉菜单 -->
                    <div id="user-dropdown" class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 z-50 hidden">
                        <a href="#" onclick="editProfile()" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
                            <i class="fas fa-user-edit mr-2"></i>编辑个人资料
                        </a>
                        <a href="#" onclick="logout()" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
                            <i class="fas fa-sign-out-alt mr-2"></i>退出登录
                        </a>
                    </div>
                </div>
            </div>
    </header>
    <!-- 修改按钮容器部分 -->
    <div class="button-container flex justify-center items-center gap-4 py-6 bg-transparent sticky top-16 z-40">
        <button id="selectedCoursesButton" onclick="showSelectedCourses()" 
        class="px-6 py-3 bg-primary text-white border-2 border-white rounded-lg font-medium hover:bg-blue-700 transition-all duration-300">
    已选课程
</button>
<button id="learnedMaterialsButton" onclick="showLearnedMaterials()" 
        class="px-6 py-3 bg-primary text-white border-2 border-white rounded-lg font-medium hover:bg-blue-700 transition-all duration-300">
    已学资料
</button>
<button id="goBackButton" 
        class="px-6 py-3 bg-primary text-white border-2 border-white rounded-lg font-medium hover:bg-blue-700 transition-all duration-300">
    返回
</button>
    </div>
    <div id="selectedCourses" class="content">
        <div id="selectedCourseList" class="course-list-container"></div>
    </div>
    <div id="learnedMaterials" class="content" style="display: none;">
        <div id="learnedResourceList"></div>
    </div>
    <!-- 查看章节模态框 -->
<div id="viewChaptersModal" class="modal">
    <div class="modal-content">
        <div class="modal-header">
            <h2 class="modal-title">课程章节</h2>
            <button class="close" onclick="closeViewChaptersModal()">&times;</button>
        </div>
        <div class="modal-body">
            <div id="chapterList"></div>
        </div>
        <div class="modal-footer">
            <button onclick="closeViewChaptersModal()" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition-colors">返回</button>
        </div>
    </div>
</div>

<!-- 查看资源模态框 -->
<div id="viewResourcesModal" class="modal">
    <div class="modal-content">
        <div class="modal-header">
            <h2 class="modal-title">课程资源</h2>
            <button class="close" onclick="closeViewResourcesModal()">&times;</button>
        </div>
        <div class="modal-body">
            <!-- 筛选控件 -->
            <div class="filter-controls">
                <div class="filter-group">
                    <label for="chapterFilter">章节筛选：</label>
                    <select id="chapterFilter" class="form-select">
                        <option value="all">全部章节</option>
                    </select>
                </div>
                <div class="filter-group">
                    <label for="fileTypeFilter">文件类型：</label>
                    <select id="fileTypeFilter" class="form-select">
                        <option value="all">全部</option>
                        <option value="pdf">PDF</option>
                        <option value="xlsx">Excel</option>
                        <option value="docx">Word</option>
                    </select>
                </div>
            </div>

            <!-- 资源列表 -->
            <div id="resourceList" class="resource-list">
            </div>
        </div>
        <div class="modal-footer">
            <button onclick="closeViewResourcesModal()" class="btn btn-secondary">返回</button>
        </div>
    </div>
</div>
    <!-- 资源所有版本模态框 -->
<div id="allVersionsModal" class="modal">
    <div class="modal-content">
        <div class="modal-header">
            <h2 class="modal-title">资源所有版本</h2>
            <button class="close" onclick="closeAllVersionsModal()">&times;</button>
        </div>
        <div class="modal-body">
            <div id="versionList" class="space-y-3"></div>
        </div>
        <div class="modal-footer">
            <button onclick="closeAllVersionsModal()" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition-colors">返回</button>
        </div>
    </div>
</div>
     <!-- 课程预览模态框 -->
     <div id="coursePreviewModal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <h2 class="modal-title">课程预览</h2>
                <button class="close" onclick="closeCoursePreviewModal()">&times;</button>
            </div>
            <div class="modal-body">
                <div id="coursePreviewInfo"></div>
            </div>
            <div class="modal-footer">
                <button onclick="closeCoursePreviewModal()" class="px-5 py-2.5 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors duration-200 font-medium">
                    返回
                </button>
            </div>
        </div>
    </div>
    <footer class="bg-dark text-white py-8 mt-12">
        <div class="container mx-auto px-4">
            <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
                <div>
                    <h3 class="text-lg font-semibold mb-4">学习轨迹查询</h3>
                    <p class="text-gray-400">学生可以在这里查看自己的已选课程和已经学习的资料，方便学生提高学习效率。</p>
                </div>
                <div>
                    <h3 class="text-lg font-semibold mb-4">联系我们</h3>
                    <ul class="space-y-2 text-gray-400">
                        <li><i class="fa-solid fa-envelope mr-2"></i> softclass-platform@qq.com</li>
                        <li><i class="fa-solid fa-phone mr-2"></i> 114-514-1919-810</li>
                    </ul>
                </div>
                <div>
                    <h3 class="text-lg font-semibold mb-4">关注我们</h3>
                    <div class="flex space-x-4">
                        <a href="#" class="text-gray-400 hover:text-white transition-colors duration-300">
                            <i class="fa-brands fa-weixin text-xl"></i>
                        </a>
                        <a href="#" class="text-gray-400 hover:text-white transition-colors duration-300">
                            <i class="fa-brands fa-weibo text-xl"></i>
                        </a>
                        <a href="#" class="text-gray-400 hover:text-white transition-colors duration-300">
                            <i class="fa-brands fa-github text-xl"></i>
                        </a>
                    </div>
                </div>
            </div>
            <div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400">
                <p>© 2025 软课程管理平台 版权所有</p>
            </div>
        </div>
    </footer>
    <script type="module" src="js/learn-track.js"></script>
</body>

</html>